import request from '@/utils/request'

// 查询规则触发器列表
export function listTrigger(query) {
  return request({
    url: '/iot/trigger/list',
    method: 'get',
    params: query
  })
}

// 查询规则触发器详细
export function getTrigger(triggerId) {
  return request({
    url: '/iot/trigger/' + triggerId,
    method: 'get'
  })
}

// 根据规则查询规则触发器
export function getTriggerByRule(ruleId) {
  return request({
    url: '/iot/trigger/getRuleTriggerByRuleId/' + ruleId,
    method: 'get'
  })
}


// 新增规则触发器
export function addTrigger(data) {
  return request({
    url: '/iot/trigger',
    method: 'post',
    data: data
  })
}

// 修改规则触发器
export function updateTrigger(data) {
  return request({
    url: '/iot/trigger',
    method: 'put',
    data: data
  })
}

// 删除规则触发器
export function delTrigger(triggerId) {
  return request({
    url: '/iot/trigger/' + triggerId,
    method: 'delete'
  })
}